package sw6.digipecs.widget.admin;

import sw6.digipecs.interfaces.OnDropListener;
import sw6.digipecs.widget.dragdrop.DropTarget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.GridView;

public class PECSBookView extends GridView implements DropTarget { 
	private OnDropListener mDropListener = null; 
	
	public void setOnDropListener(OnDropListener listener)
	{
		this.mDropListener=listener; 
	}
	
	public PECSBookView(Context context) {
		super(context);
	}
	
	public PECSBookView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public PECSBookView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	@Override
	public boolean drop(View view, int x, int y) {
		if(mDropListener!=null)
			if (mDropListener.onDrop(view)) {
				view.setVisibility(VISIBLE);
				return true;
			} else {
				return false;
			}
		else
			return false;
	}
	
	@Override
	public void onDragOut() {
		// TODO Auto-generated method stub
	}
	
	@Override
	public void onDragIn(int x, int y) {
		// TODO Auto-generated method stub
	}
}
